/**
 * Copyright (C), 2015-2019, 静修教育咨询有限公司
 * FileName: ParentController
 * Author:  SAGIRI
 * Date:     2019/7/22 0022 11:28
 * Description: 家长控制器
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.ruimei.controller;

import com.alibaba.fastjson.JSONObject;
import com.ruimei.entitys.*;
import com.ruimei.service.IParentService;
import com.ruimei.util.TokenUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 〈概要〉<br> 
 * 〈家长控制器〉
 *
 * @author SAGIRI
 * @create 2019/7/22 0022
 * @since 1.0.0
 */
@RestController
@Api(tags = "家长控制器")
public class ParentController {
    @Resource
    private IParentService iParentService;

    @PostMapping("/updateParentInfo")
    @ApiOperation(value = "变更家长信息")
    public JSONObject updateParentInfo(Parent parent){
        return iParentService.updateParentInfo(parent);
    }

    @PostMapping("/updateStudentInfo")
    @ApiOperation(value = "修改学生档案信息")
    public JSONObject updateStudentInfo(Student student){
        return iParentService.updateStudentInfo(student);
    }

    @PostMapping("/getStudentHobby")
    @ApiOperation(value = "获取学生爱好特长信息")
    public JSONObject getStudentHobby(String id){
        return iParentService.getStudentHobby(id);
    }

    @PostMapping("/saveStudentHobby")
    @ApiOperation(value = "保存或更新学生的爱好特长记录")
    public JSONObject saveStudentHobby(Hobby hobby){
        return iParentService.saveStudentHobby(hobby);
    }

    @PostMapping("/queryStudentReward")
    @ApiOperation(value = "查询奖惩记录")
    public JSONObject queryStudentReward(String id){
        return iParentService.queryStudentReward(id);
    }
    @PostMapping("/saveStudentReward")
    @ApiOperation(value = "查询奖惩记录")
    public JSONObject saveStudentReward(Reward reward){
        return iParentService.saveStudentReward(reward);
    }
    @PostMapping("/bindStudent")
    @ApiOperation(value = "绑定学生")
    public JSONObject bindStudent(String studentIdCard, String relation, HttpServletRequest request){
        return iParentService.bindStudent(TokenUtils.getParentId(request),studentIdCard,relation);
    }
}
